using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Splino
{
    /// <summary>
    /// An MDI Child dummy window for SplinoForm to use for MDI layouts.
    /// The render window is contained within the SplinoWindow class.
    /// </summary>
    public partial class SplinoFormChild : Form
    {
        SplinoWindow _splinoWindow;
        /// <summary>
        /// Gets or sets the SplinoWindow that uses this dummy window's layout
        /// </summary>
        public SplinoWindow SplinoWindow
        {
            get { return _splinoWindow; }
            set { _splinoWindow = value; }
        }

        /// <summary>
        /// Constructor
        /// </summary>
        public SplinoFormChild(SplinoWindow splinoWindow)
        {
            InitializeComponent();
            _splinoWindow = splinoWindow;
        }

        private void SplinoFormChild_Move(object sender, EventArgs e)
        {
            _splinoWindow.Location = new Point(Location.X, Location.Y);
        }

        private void SplinoFormChild_Resize(object sender, EventArgs e)
        {
            _splinoWindow.Size = Size;
        }

        private void SplinoFormChild_VisibleChanged(object sender, EventArgs e)
        {
            if (_splinoWindow.Initialized)
                SplinoForm.Instance.LayoutSplinoWindows();
        }

        private void SplinoFormChild_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_splinoWindow.Initialized)
                SplinoForm.Instance.LayoutSplinoWindows();
        }
    }
}